<template>
  <div>
    <el-container style="height: 100%; border: 1px solid #eee">
      <el-aside :width="aside_witdh" style="background-color: rgb(238, 241, 246);height:100%;margin-left: -1px;">
        <Aside :isCollapse="isCollapse"></Aside>
      </el-aside>

      <el-container style="height: 100%;">
        <el-header style="text-align: right;height: 100%; font-size: 12px;border-bottom: #d7d9d9 1px solid">
          <Header @doCollapse="doCollapse" :icon="icon"></Header>
        </el-header>

        <el-main style="height: 100%;">
          <router-view />
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import Aside from "@/components/Aside";
import Header from "@/components/Header";
export default {
  name: "Index",
  components: { Header, Aside },
  data() {
    return {
      user: JSON.parse(sessionStorage.getItem('CurUser') || '{}'),
      isCollapse: false,
      aside_witdh: '200px',  //默认宽度
      icon: 'el-icon-s-fold' //默认图标
    }
  },
  methods: {

    doCollapse() {
      console.log(111)
      this.isCollapse = !this.isCollapse
      if (!this.isCollapse) {
        //展开式侧边栏的宽度和图标变化
        this.aside_witdh = '200px'
        this.icon = 'el-icon-s-fold'
      } else {
        //收缩起来侧边栏的宽度和图标变化
        this.aside_witdh = '64px'
        this.icon = 'el-icon-s-unfold'
      }
    },
    
    
  }

};
</script>

<style scoped>
.el-header {
  /*background-color: #B3C0D1;*/
  color: #333;
  line-height: 60px;
}

.el-main {
  padding: 5px;
}

.el-aside {
  color: #333333;
}
</style>